package com.sjmsks.Jpanels.work.shape;

import java.awt.*;

// 自定义的三角形控件
public class Triangle extends AbstractShape {


	@Override
	public void draw(Graphics2D g2d) {
		g2d.setPaint(getColor());
		g2d.setStroke(getStroke());
		int[] x = {(x1 + x2) / 2, x1, x2};
		int[] y = {y1, y2, y2};
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.drawPolygon(x, y, 3);
	}

	@Override
	public Color getColor() {
		return super.getColor();
	}

	@Override
	public void setColor(Color color) {
		super.setColor(color);
	}

	@Override
	public Stroke getStroke() {
		return super.getStroke();
	}

	@Override
	public void setStroke(Stroke stroke) {
		super.setStroke(stroke);
	}
}
